﻿using Com.Lancetinc.Evs.Helpers;
using System;
using System.Windows.Data;

namespace Com.Lancetinc.Evs.WpfTools
{
    public class SexConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var sexFlag = value?.ToString();
            if (string.IsNullOrEmpty(sexFlag))
                return string.Empty;

            if (sexFlag == "1")
            {
                return I18nHelper.Default.GetMessage("Male");
            }
            if (sexFlag == "0")
            {
                return I18nHelper.Default.GetMessage("Female");
            }

            return string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
